﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using Microsoft.Practices.Unity;
using Infrastructure.Web.Services.Mobile;

namespace Skynet.WebSite.Mobile
{
    public partial class _default : Infrastructure.Web.Views.Page
    {


        [Dependency]
        public IMobileService MobileService { protected get; set; }



        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.MobileService.IsMobileDevice())
            {
                Response.Redirect("~/default.aspx");
                return;
            }
            else if (this.MobileService.IsWmlDevice())
            {
                Response.Redirect("~/Mobile/Menu/WAP/default.wml");
            }
            else if (Request.UserAgent == "SAMSUNG-SGH-I637/1.0 Profile/MIDP-2.1 Configuration/CLDC-1.1 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)")
            {
                Response.Redirect("~/Mobile/Menu/SSI637/default.aspx");
            }
            else if (Request.Browser.Type == "IEMobile7" && Request.Browser.Version == "7.0" && Request.Browser.Id == "iemobile")
            {
                Response.Redirect("~/Mobile/Menu/WM7/default.aspx");
            }
            else if (Request.Browser.Type == "Safari4" && Request.Browser.MobileDeviceModel == "IPhone" && Request.Browser.MobileDeviceManufacturer == "Apple")
            {
                Response.Redirect("~/Mobile/Menu/IPHONE/default.aspx");
            }            
        }
    }
}